import request from '@/utils/request'

/* export const demoFetch = (data) => request({
  url: '/demo',
  method: 'post',
  data
})
 */

export const task = (params) => request({
  url: '/activiti/task',
  method: 'get',
  params
})

export const taskHistory = (params) => request({
  url: '/activiti/task/history',
  method: 'get',
  params
})

export const putTask = (data) => request({
  url: '/activiti/task',
  method: 'put',
  data
})

export const GetEquipment = (data) => request({
  url: '/equipment/equipment/selectEquipmentByLike',
  method: 'post',
  data
})

export const GetEquipmentInfo = (params) => {
  return request({
    url: `/equipment/equipment/selectEquipmentById/${params.id}`,
    method: 'get',
    params
  })
}

export const GetTaskVariables = (params) => {
  return request({
    url: '/equipment/equipment/taskVariables',
    method: 'get',
    params
  })
}

export const getRecord = (params) => {
  let url = ''
  if (params.id) {
    url = '/activiti/instance/history/' + params.id
    delete params.id
  } else {
    url = '/activiti/instance/history'
  }
  return request({
    url: url,
    method: 'get',
    params
  })
}
export const getUser = (params) => { // 根据id 获取人员姓名
  return request({
    url: '/auth/admin/userInfo/map',
    method: 'get',
    params
  })
}
export const getCheckStatus = (params) => {
  return request({
    url: '/auth/checkStatus',
    method: 'get',
    params
  })
}

export const getAvueForm = (params) => {
  return request({
    url: '/activiti/taskVariables',
    method: 'get',
    params
  })
}

export const putAvueForm = (data) => {
  return request({
    url: '/activiti/task',
    method: 'put',
    data
  })
}

export const taskVariables = (params) => {
  return request({
    url: '/activiti/taskVariables',
    method: 'get',
    params
  })
}
export const getDefinition = (params) => {
  return request({
    url: '/activiti/definition',
    method: 'get',
    params
  })
}

export const getInstance = (data) => { // 启动流程实例
  return request({
    url: '/activiti/instance',
    method: 'post',
    data
  })
}

export const infoPush = (data) => { // 通知
  return request({
    url: '/auth/admin/notice/template',
    method: 'post',
    data
  })
}

export const equipment = (data) => {
  return request({
    url: '/equipment/equipment/putEquipment',
    method: 'put',
    data
  })
}

export const serialNumber = (params) => {
  return request({
    url: '/activiti/autoFormatNo/No',
    method: 'get',
    params
  })
}

export const delNumber = (data) => {
  return request({
    url: '/activiti/autoFormatNo/cache',
    method: 'delete',
    data
  })
}
